import 'package:flutter/material.dart';
import 'package:flutterhello/util/host_util.dart';
import 'package:get/get.dart';

class InviteCard extends StatelessWidget {
  var info;
  InviteCard({Key key, this.info}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.only(left: 15, right: 15, bottom: 10),
      child: getCard(),
    );
  }

  getCard() {
    return GestureDetector(
      child: Container(
        decoration: BoxDecoration(
          borderRadius: BorderRadius.all(Radius.circular(5.0)),
          color: Colors.white,
          boxShadow: [
            BoxShadow(
                color: Colors.grey[400],
                offset: Offset(0, 1), // 偏移量
                blurRadius: 2),
          ],
        ),
        child: Padding(
          padding: EdgeInsets.only(left: 20, right: 20, bottom: 10, top: 10),
          child: Container(
            height: 50,
            width: double.infinity,
            child: Row(
              children: [
                GestureDetector(
                  child: Container(
                    width: 50,
                    height: 50,
                    child: ClipRRect(
                        borderRadius: BorderRadius.all(Radius.circular(5)),
                        child: Image.network(
                          HostUtil.getHost() + info['group'][0]['favicon'],
                          fit: BoxFit.cover,
                        )),
                  ),
                  onTap: () => {},
                ),
                SizedBox(
                  width: 20,
                ),
                Expanded(
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(info['title']),
                      Text(
                        info['content'],
                        maxLines: 1,
                        style: TextStyle(color: Colors.black54),
                      ),
                    ],
                  ),
                )
              ],
            ),
          ),
        ),
      ),
      onTap: () {
        Get.toNamed('/inv_detail', arguments: info);
      },
    );
  }
}
